package com.hc.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 测试循环依赖
 *
 * @author huangchao E-mail:fengquan8866@163.com
 * @version 创建时间：2024/6/9 10:47
 */
@Aspect
@Component
@Slf4j
public class AopConfig {

    /**
     * 切点
     */
    @Pointcut("execution(* com.hc.service.AaService.*(..))")
    public void pointcut() {

    }

    /**
     * 环绕通知
     *
     * @param joinPoint 切点
     * @return
     * @throws Throwable
     */
    @Around("pointcut()")
    public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("进入了环绕通知~");
        String str = joinPoint.proceed().toString();
        log.info("退出了环绕通知~");
        return str;
    }
}